package com.len.controller;

import com.len.entity.Account;
import com.len.mapper.AccountMapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("account")
public class AccountController {

    private final AccountMapper accountMapper;

    public AccountController(AccountMapper accountMapper) {
        this.accountMapper = accountMapper;
    }

    @GetMapping("")
    public String get() {
        List<Account> accounts = accountMapper.selectAll();
        return accounts.get(0).getUserName();
    }
}
